package com.example.demo.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

//@WebFilter
//public class UserFilter implements Filter{
//
//	@Override
//	public void init(FilterConfig filterConfig) throws ServletException {
//		// TODO Auto-generated method stub
//		
//	}
//
//	@Override
//	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
//			throws IOException, ServletException {
////		// 将ServletRequest request对象转换为HttpServlet对象
////		HttpServletRequest s = (HttpServletRequest) request;
////		HttpServletResponse s2 = (HttpServletResponse) response;
////		// 获取当前资源路径
////		String uri = s.getRequestURI();
////		if (uri.endsWith("approve.html") || uri.endsWith("check.html")|| uri.endsWith("comboset.html")|| uri.endsWith("feedback.html")) {
////			// 获取session对象
////			HttpSession hs = s.getSession();
////			Object o = hs.getAttribute("account");
////			if (o == null) {
////				s2.sendRedirect("../terrace");
////				return;
////			}
////		}
//		chain.doFilter(request, response);
//		
//	}
//
//	@Override
//	public void destroy() {
//		// TODO Auto-generated method stub
//		
//	}
//
//}
